/* 
 * File:   Activity.hpp
 * Author: bd
 *
 * Created on March 26, 2011, 2:45 PM
 */

#ifndef ACTIVITY_HPP
#define	ACTIVITY_HPP
#include <boost/shared_ptr.hpp>

#include "Configuration.hpp"

template <typename T>
class Pool;
class ShortMsgItem;

/*
 * Abstract base class for activities, eg. DeliveryActivity, FailoverActivity, ControllerActivity, etc.
 *
 * Responsibilities:
 *      - Monitors Application object, in order to determine if it must go on or stop.
 *      - Activities are configured in the Application class
 *      - 
 */
class Activity {
public:
    typedef boost::shared_ptr<Activity> ActivityPtr;

public:
    Activity();
    Activity(const Activity& orig);
    explicit Activity(const std::string& name, const Configuration& config, Pool<ShortMsgItem>& pool);
    virtual ~Activity();

    //Member functions
    virtual void start() = 0;
    virtual void stop() = 0;
    void wait();


    void operator()();

    //Getter - Setter
    void name(std::string name_);
    std::string name() const;

protected:
    Configuration config_;
    Pool<ShortMsgItem>& pool_;
    std::string name_;
private:
};

#endif	/* ACTIVITY_HPP */

